const events = require("events");
const fs = require("fs");
const path = require("path");
let eventEmitter = new events.EventEmitter();


//接受广播
eventEmitter.on('to_parent', function (data) {
    console.log(data);
});

//发送广播
// setTimeout(function () {
//     eventEmitter.emit("to_parent", "aaaaa啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊")
// }, 300);


fs.readFile(path.join(__dirname, "mime.json"), function (err, data) {
    eventEmitter.emit("to_parent", data.toString())
});